﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Data.Objects;

namespace Defero.Model
{
    public class ServiceConfiguration : EntityConfiguration<Service>
    {
        public ServiceConfiguration() 
        {
            Property(e => e.Id).IsIdentity();
            Property(e => e.Name).HasDefaultMaxLength();
            Property(e => e.DefaultPrice).HasDefaultMoneyPrecision();
            Property(e => e.IsCombo);

            Relationship(e => e.Type);
            Relationship(e => e.Specialties)
                .FromProperty(e => e.Service)
                .IsOptional();
            Relationship(e => e.Dependencies)
                .FromProperty(e => e.Service)
                .IsOptional();
        }
    }
}
